def get_primes(n):
    sieve = [True] * n
    primes = []
    for p in range(2, n):
        if sieve[p]:
            primes.append(p)
        for i in range(p * p, n, p):
            sieve[i] = False
    return primes


numbers = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
q = input()
q = q.split(' ')
f = 0
a = ''
for i in q:
    if i in q:
        f+=1
if f != 3 or len(q) != 3:
    print('Wrong input')

for i in range(3):
    a += str(numbers.index(q[i]))
a = int(a)

pr = get_primes(a)
print(pr[len(pr)-1])